package com.wch.SpringBootTestDemo.jwt;

import java.util.Date;

import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

/**
 * create by WanChengHe 20190426 
 * 测试jwt，用于生成token
 * @author 19821
 *
 */
public class CreateJwtTest {

	public static void main(String[] args) {
		JwtBuilder builder = Jwts.builder().setId("888")
					  .setSubject("大白")
					  .setIssuedAt(new Date())        //设置签发时间
					  .signWith(SignatureAlgorithm.HS256, "itcast");  //签名密钥
		System.out.println(builder.compact());
	}
}
